#/usr/bin/env python
# -*- coding: utf8 -*-
# title       :
# description :
# author      :'ShenMeng'

import pymel.core as pmel


class Validation():
    name = u'Smooth | 细分'
    dataDict = dict()

    def execute(self):
        self.dataDict = {}
        meshList = pmel.ls(type='mesh')
        if meshList:
            for mesh in meshList:
                if mesh.displaySmoothMesh.get():
                    self.dataDict[mesh.name()] = [mesh.displaySmoothMesh.name()]
        return self.dataDict

    def correct(self):
        if self.dataDict:
            for k, attrList in self.dataDict.items():
                for attr in attrList:
                    attrNode = pmel.PyNode(attr)
                    attrNode.set(0)

    def search(self, obj):
        pmel.select(obj)
